﻿//求水仙花数
#include <stdio.h>
#include <math.h>
int main()
{
	int i = 0;
	for (i = 1; i <= 100000; i++)
	{
		//判断i是否是⾃幂数
		//1. 计算i的位数n
		int n = 0;
		int tmp = i;
		while (tmp)
		{
			n++;
			tmp /= 10;
		}
		//2. 计算i的每⼀位的n次⽅之和
		tmp = i;
		int sum = 0;
		while (tmp)
		{
			sum += pow(tmp % 10, n);
			tmp /= 10;
		}
		//3. 输出
		if (sum == i)
			printf("%d ", i);
	}
	return 0;
}